*------------------------------------------------------------------------------------------------------------%	
* Table 2: Large retailer VMW effects on own wages and employment
*------------------------------------------------------------------------------------------------------------%	
* Load own policy firm data
	use "$data/cb/stacked_policy_firm_dataset.dta", clear
	
	* Restrict to experiment window
	keep if inrange(etime,-6, 5)
	drop if trt_exp==4
	gen own_gap=T
	
	* Indicator for post policy
	gen postperiod = etime>=0

	* Winsorize new hires variable due to outliers
	*hist ln_tot_new_hires_7_29 if mw==15
	bysort trt_exp: sum ln_tot_new_hires_7_29,d
	replace ln_tot_new_hires_7_29 = . if ln_tot_new_hires_7_29>`r(p90)' | ln_tot_new_hires_7_29<`r(p10)'
	
	* Regress ------------------------------------------------------------------
	eststo clear

	* All events
	preserve
	keep if !missing(ln_tot_new_hires_7_29) & !missing(sep_rate_7_29) & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a1: reghdfe ln_avg_wage_exact  D if !missing(ln_tot_new_hires_7_29) & !missing(sep_rate_7_29) & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local wage_effect=_b[D]
		gen keep1 = e(sample) == 1
	eststo b1: reghdfe ln_tot_emp_7_29 D if keep1 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local emp_7_29_effect=_b[D]
	eststo c1: reghdfe sep_rate_7_29 D if keep1 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local sep_7_29_effect=_b[D]
	eststo d1: reghdfe sep_to_nonpolicy_rate D if keep1 == 1 , absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local quit_effect=_b[D]
	eststo e1: reghdfe ln_tot_new_hires_7_29 D if keep1 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local nh_7_29_effect=_b[D]
	eststo f1: ivreghdfe ln_tot_emp_7_29 (ln_avg_wage_exact  = D) if keep1 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz) first 
	local emp_elast=_b[ln_avg_wage_exact]
		PrintEst `emp_elast' "emp_elast_all"	"" "%" 4.2f "$figures_tables/text"
		distinct cz if keep1 == 1
		estadd local Ncz `r(ndistinct)': f1
		sum own_gap if keep1 == 1
		estadd local sdgap=round(`r(sd)',.01): f1

		* Save standardized beta effects
		* Wage
		local wage_effect_pct=100*(exp(`wage_effect')-1)
		PrintEst `wage_effect_pct' "wage_effect_pct_all"	"" "%" 4.2f "$figures_tables/text"
		* Emp
		local emp_7_29_effect_pct=100*(exp(`emp_7_29_effect')-1)
		PrintEst `emp_7_29_effect_pct' "emp_7_29_effect_pct_all"	"" "%" 4.2f "$figures_tables/text"
		* Sep
		local sep_7_29_effect_abs=abs(100*(`sep_7_29_effect'))
		PrintEst `sep_7_29_effect_abs' "sep_7_29_effect_abs_all"	"" "%" 4.2f "$figures_tables/text"
		* Sep to non-policy
		local quit_effect_abs=abs(100*(`quit_effect'))
		PrintEst `quit_effect_abs' "quit_effect_abs_all"	"" "%" 4.2f "$figures_tables/text"
		* Log new hires
		local nh_7_29_effect_pct=100*(exp(`nh_7_29_effect')-1)
		PrintEst `nh_7_29_effect_pct' "nh_7_29_effect_pct_all"	"" "%" 4.2f "$figures_tables/text"
		
		* Save normalized effects (beta divided by average gap)
		* Wage
		local norm_wage_effect=100*(exp(`wage_effect'*`r(mean)')-1)
		PrintEst `norm_wage_effect' "norm_wage_effect_all"	"" "%" 4.2f "$figures_tables/text"
		* Emp
		local norm_emp_7_29_effect=100*(exp(`emp_7_29_effect'*`r(mean)')-1)
		PrintEst `norm_emp_7_29_effect' "norm_emp_7_29_effect_all"	"" "%" 4.2f "$figures_tables/text"
		* Sep
		local norm_sep_7_29_effect=abs(100*(`sep_7_29_effect'*`r(mean)'))
		PrintEst `norm_sep_7_29_effect' "norm_sep_7_29_effect_all"	"" "%" 4.2f "$figures_tables/text"
		* Sep to non-policy
		local norm_quit_effect=abs(100*(`quit_effect'*`r(mean)'))
		PrintEst `norm_quit_effect' "norm_quit_effect_all"	"" "%" 4.2f "$figures_tables/text"
		* YOY new hires
		local norm_nh_7_29_effect=100*(exp(`nh_7_29_effect'*`r(mean)')-1)
		PrintEst `norm_nh_7_29_effect' "norm_nh_7_29_effect_all"	"" "%" 4.2f "$figures_tables/text"
		
		distinct trt_exp if keep1 ==1
		estadd local Nexp `r(ndistinct)': f1
		sum sep_rate_7_29 if keep1==1 & postperiod==0
		local pre_mean_sep_7_29_effect=100*`r(mean)'
		PrintEst `pre_mean_sep_7_29_effect' "pre_mean_sep_7_29_effect_all"	"" "%" 4.2f "$figures_tables/text"
		estadd local MeanSep=round(`r(mean)',.001)
		local norm_rel_sep_7_29_effect=abs(`norm_sep_7_29_effect'/`r(mean)')
		PrintEst `norm_rel_sep_7_29_effect' "norm_rel_sep_7_29_effect_all"	"" "%" 4.2f "$figures_tables/text"
		local rel_sep_7_29_effect=(`sep_7_29_effect_abs'/`r(mean)')
		PrintEst `rel_sep_7_29_effect' "rel_sep_7_29_effect_all"	"" "%" 4.2f "$figures_tables/text"
		sum sep_to_nonpolicy_rate if keep1==1 & postperiod==0
		local pre_mean_quit_effect=100*`r(mean)'
		PrintEst `pre_mean_quit_effect' "pre_mean_quit_effect_all"	"" "%" 4.2f "$figures_tables/text"
		estadd local MeanSepNP=round(`r(mean)',.001)
		local norm_rel_quit_effect=abs(`norm_quit_effect'/`r(mean)')
		PrintEst `norm_rel_quit_effect' "norm_rel_quit_effect_all"	"" "%" 4.2f "$figures_tables/text"
		local rel_quit_effect=(`quit_effect_abs'/`r(mean)')
		PrintEst `rel_quit_effect' "rel_quit_effect_all"	"" "%" 4.2f "$figures_tables/text"
		
		local quit_elast=(100*`quit_effect'/`r(mean)')/(`wage_effect_pct')
		PrintEst `quit_elast' "quit_elast_all"	"" "%" 4.2f "$figures_tables/text"
		local LS_elast=abs(2*`quit_elast')
		PrintEst `LS_elast' "LS_elast_all"	"" "%" 4.2f "$figures_tables/text"
	
		sum ln_tot_new_hires_7_29 if keep1==1 & postperiod==0
		estadd local MeanNH=round(`r(mean)',.01)
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"
		
	restore	
	
	* Major
	preserve
	keep if !missing(ln_tot_new_hires_7_29) & !missing(sep_rate_7_29) & share_affected >= .3 & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
		
	eststo a2: reghdfe ln_avg_wage_exact  D if !missing(ln_tot_new_hires_7_29) & !missing(sep_rate_7_29) & share_affected >= .3 & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local wage_effect=_b[D]
		gen keep2 = e(sample) == 1
	eststo b2: reghdfe ln_tot_emp_7_29 D if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local emp_7_29_effect=_b[D]
	eststo c2: reghdfe sep_rate_7_29 D if keep2 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local sep_7_29_effect=_b[D]
	eststo d2: reghdfe sep_to_nonpolicy_rate D if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local quit_effect=_b[D]
	eststo e2: reghdfe ln_tot_new_hires_7_29 D if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local nh_7_29_effect=_b[D]
	eststo f2: ivreghdfe ln_tot_emp_7_29 (ln_avg_wage_exact  = D) if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz) first 
	local emp_elast=_b[ln_avg_wage_exact]
		PrintEst `emp_elast' "emp_elast_major"	"" "%" 4.2f "$figures_tables/text"
		distinct cz if keep2 == 1
		estadd local Ncz `r(ndistinct)': f2
		sum own_gap if keep2 == 1
		estadd local sdgap=round(`r(sd)',.01): f2 
		
		* Save standardized beta effects
		* Wage
		local wage_effect_pct=100*(exp(`wage_effect')-1)
		PrintEst `wage_effect_pct' "wage_effect_pct_major"	"" "%" 4.2f "$figures_tables/text"
		* Emp
		local emp_7_29_effect_pct=100*(exp(`emp_7_29_effect')-1)
		PrintEst `emp_7_29_effect_pct' "emp_7_29_effect_pct_major"	"" "%" 4.2f "$figures_tables/text"
		* Sep
		local sep_7_29_effect_abs=abs(100*(`sep_7_29_effect'))
		PrintEst `sep_7_29_effect_abs' "sep_7_29_effect_abs_major"	"" "%" 4.2f "$figures_tables/text"
		* Sep to non-policy
		local quit_effect_abs=abs(100*(`quit_effect'))
		PrintEst `quit_effect_abs' "quit_effect_abs_major"	"" "%" 4.2f "$figures_tables/text"
		* Log new hires
		local nh_7_29_effect_pct=100*(exp(`nh_7_29_effect')-1)
		PrintEst `nh_7_29_effect_pct' "nh_7_29_effect_pct_major"	"" "%" 4.2f "$figures_tables/text"
		
		* Save normalized effects (beta divided by average gap)
		* Wage
		local norm_wage_effect=100*(exp(`wage_effect'*`r(mean)')-1)
		PrintEst `norm_wage_effect' "norm_wage_effect_major"	"" "%" 4.2f "$figures_tables/text"
		* Emp
		local norm_emp_7_29_effect=100*(exp(`emp_7_29_effect'*`r(mean)')-1)
		PrintEst `norm_emp_7_29_effect' "norm_emp_7_29_effect_major"	"" "%" 4.2f "$figures_tables/text"
		* Sep
		local norm_sep_7_29_effect=abs(100*(`sep_7_29_effect'*`r(mean)'))
		PrintEst `norm_sep_7_29_effect' "norm_sep_7_29_effect_major"	"" "%" 4.2f "$figures_tables/text"
		* Sep to non-policy
		local norm_quit_effect=abs(100*(`quit_effect'*`r(mean)'))
		PrintEst `norm_quit_effect' "norm_quit_effect_major"	"" "%" 4.2f "$figures_tables/text"
		* YOY new hires
		local norm_nh_7_29_effect=100*(exp(`nh_7_29_effect'*`r(mean)')-1)
		PrintEst `norm_nh_7_29_effect' "norm_nh_7_29_effect_major"	"" "%" 4.2f "$figures_tables/text"
		
		distinct trt_exp if keep2 ==1
		estadd local Nexp `r(ndistinct)': f2
		sum sep_rate_7_29 if keep2==1 & postperiod==0
		local pre_mean_sep_7_29_effect=100*`r(mean)'
		PrintEst `pre_mean_sep_7_29_effect' "pre_mean_sep_7_29_effect_major"	"" "%" 4.2f "$figures_tables/text"
		estadd local MeanSep=round(`r(mean)',.001)
		local norm_rel_sep_7_29_effect=abs(`norm_sep_7_29_effect'/`r(mean)')
		PrintEst `norm_rel_sep_7_29_effect' "norm_rel_sep_7_29_effect_major"	"" "%" 4.2f "$figures_tables/text"
		local rel_sep_7_29_effect=(`sep_7_29_effect_abs'/`r(mean)')
		PrintEst `rel_sep_7_29_effect' "rel_sep_7_29_effect_major"	"" "%" 4.2f "$figures_tables/text"
		sum sep_to_nonpolicy_rate if keep2==1 & postperiod==0
		local pre_mean_quit_effect=100*`r(mean)'
		PrintEst `pre_mean_quit_effect' "pre_mean_quit_effect_major"	"" "%" 4.2f "$figures_tables/text"
		estadd local MeanSepNP=round(`r(mean)',.001)
		local norm_rel_quit_effect=abs(`norm_quit_effect'/`r(mean)')
		PrintEst `norm_rel_quit_effect' "norm_rel_quit_effect_major"	"" "%" 4.2f "$figures_tables/text"
		local rel_quit_effect=(`quit_effect_abs'/`r(mean)')
		PrintEst `rel_quit_effect' "rel_quit_effect_major"	"" "%" 4.2f "$figures_tables/text"
		
		local quit_elast=(100*`quit_effect'/`r(mean)')/(`wage_effect_pct')
		PrintEst `quit_elast' "quit_elast_major"	"" "%" 4.2f "$figures_tables/text"
		local LS_elast=abs(2*`quit_elast')
		PrintEst `LS_elast' "LS_elast_major"	"" "%" 4.2f "$figures_tables/text"
		
		sum ln_tot_new_hires_7_29 if keep2==1 & postperiod==0
		estadd local MeanNH=round(`r(mean)',.01)
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"
		
		restore
		
	* $15
	preserve
	keep if !missing(ln_tot_new_hires_7_29) & !missing(sep_rate_7_29) & mw == 15 & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a3: reghdfe ln_avg_wage_exact  D if !missing(ln_tot_new_hires_7_29) & !missing(sep_rate_7_29) & mw == 15 & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local wage_effect=_b[D]
		gen keep3 = e(sample) == 1
	eststo b3: reghdfe ln_tot_emp_7_29 D if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local emp_7_29_effect=_b[D]
	eststo c3: reghdfe sep_rate_7_29 D if keep3 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local sep_7_29_effect=_b[D]
	eststo d3: reghdfe sep_to_nonpolicy_rate D if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local quit_effect=_b[D]
	eststo e3: reghdfe ln_tot_new_hires_7_29 D if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local nh_7_29_effect=_b[D]
	eststo f3: ivreghdfe ln_tot_emp_7_29 (ln_avg_wage_exact  = D) if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz) first 
	local emp_elast=_b[ln_avg_wage_exact]
		PrintEst `emp_elast' "emp_elast_15"	"" "%" 4.2f "$figures_tables/text"
		distinct cz if keep3 == 1
		estadd local Ncz `r(ndistinct)': f3
		sum own_gap if keep3 == 1
		estadd local sdgap=round(`r(sd)',.01): f3

		* Save standardized beta effects
		* Wage
		local wage_effect_pct=100*(exp(`wage_effect')-1)
		PrintEst `wage_effect_pct' "wage_effect_pct_15"	"" "%" 4.2f "$figures_tables/text"
		* Emp
		local emp_7_29_effect_pct=100*(exp(`emp_7_29_effect')-1)
		PrintEst `emp_7_29_effect_pct' "emp_7_29_effect_pct_15"	"" "%" 4.2f "$figures_tables/text"
		* Sep
		local sep_7_29_effect_abs=abs(100*(`sep_7_29_effect'))
		PrintEst `sep_7_29_effect_abs' "sep_7_29_effect_abs_15"	"" "%" 4.2f "$figures_tables/text"
		* Sep to non-policy
		local quit_effect_abs=abs(100*(`quit_effect'))
		PrintEst `quit_effect_abs' "quit_effect_abs_15"	"" "%" 4.2f "$figures_tables/text"
		* Log new hires
		local nh_7_29_effect_pct=100*(exp(`nh_7_29_effect')-1)
		PrintEst `nh_7_29_effect_pct' "nh_7_29_effect_pct_15"	"" "%" 4.2f "$figures_tables/text"
		
		* Save normalized effects (beta divided by average gap)
		* Wage
		local wage_effect_log_pts=round(100*`wage_effect',1)
		PrintEst `wage_effect_log_pts' "wage_effect_log_pts_15" "" "%" 4.0f "$figures_tables/text"
		local norm_wage_effect=100*(exp(`wage_effect'*`r(mean)')-1)
		PrintEst `norm_wage_effect' "norm_wage_effect_15"	"" "%" 4.2f "$figures_tables/text"
		* Emp
		local norm_emp_7_29_effect=100*(exp(`emp_7_29_effect'*`r(mean)')-1)
		PrintEst `norm_emp_7_29_effect' "norm_emp_7_29_effect_15"	"" "%" 4.2f "$figures_tables/text"
		* Sep
		local norm_sep_7_29_effect=abs(100*(`sep_7_29_effect'*`r(mean)'))
		PrintEst `norm_sep_7_29_effect' "norm_sep_7_29_effect_15"	"" "%" 4.2f "$figures_tables/text"
		* Sep to non-policy
		local norm_quit_effect=abs(100*(`quit_effect'*`r(mean)'))
		PrintEst `norm_quit_effect' "norm_quit_effect_15"	"" "%" 4.2f "$figures_tables/text"
		* YOY new hires
		local norm_nh_7_29_effect=100*(exp(`nh_7_29_effect'*`r(mean)')-1)
		PrintEst `norm_nh_7_29_effect' "norm_nh_7_29_effect_15"	"" "%" 4.2f "$figures_tables/text"
		
		distinct trt_exp if keep3 ==1
		estadd local Nexp `r(ndistinct)': f3
		sum sep_rate if keep3==1 & postperiod==0
		local pre_mean_sep_7_29_effect=100*`r(mean)'
		PrintEst `pre_mean_sep_7_29_effect' "pre_mean_sep_7_29_effect_15"	"" "%" 4.2f "$figures_tables/text"
		estadd local MeanSep=round(`r(mean)',.001)
		local norm_rel_sep_7_29_effect=abs(`norm_sep_7_29_effect'/`r(mean)')
		PrintEst `norm_rel_sep_7_29_effect' "norm_rel_sep_7_29_effect_15"	"" "%" 4.2f "$figures_tables/text"
		local rel_sep_7_29_effect=(`sep_7_29_effect_abs'/`r(mean)')
		PrintEst `rel_sep_7_29_effect' "rel_sep_7_29_effect_15"	"" "%" 4.2f "$figures_tables/text"
		sum sep_to_nonpolicy_rate if keep3==1 & postperiod==0
		local pre_mean_quit_effect=100*`r(mean)'
		PrintEst `pre_mean_quit_effect' "pre_mean_quit_effect_15"	"" "%" 4.2f "$figures_tables/text"
		estadd local MeanSepNP=round(`r(mean)',.001)
		local norm_rel_quit_effect=abs(`norm_quit_effect'/`r(mean)')
		PrintEst `norm_rel_quit_effect' "norm_rel_quit_effect_15"	"" "%" 4.2f "$figures_tables/text"
		local rel_quit_effect=(`quit_effect_abs'/`r(mean)')
		PrintEst `rel_quit_effect' "rel_quit_effect_15"	"" "%" 4.2f "$figures_tables/text"
		
		local quit_elast=(100*`quit_effect'/`r(mean)')/(`wage_effect_pct')
		PrintEst `quit_elast' "quit_elast_15"	"" "%" 4.2f "$figures_tables/text"
		local LS_elast=abs(2*`quit_elast')
		PrintEst `LS_elast' "LS_elast_15"	"" "%" 4.2f "$figures_tables/text"
		
		sum ln_tot_new_hires_7_29 if keep3==1 & postperiod==0
		estadd local MeanNH=round(`r(mean)',.01)
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"
	restore
	
	* Build table --------------------------------------------------------------
	
	#d ;
	esttab a* 
			using "$figures_tables/table2_own_effects.tex",  
			replace label fragment
			nolines  
			prehead("\begin{threeparttable} \begin{tabular}{lccccc} \toprule \toprule \\ Indep. Var.: Large Retailer Gap X 1(Post)") 
			posthead("\cmidrule(lr){2-4}" "Dep. Var.:  & & & \\") 
			booktabs								
			nonumbers 
			mtitles("All events" "Major events" "\\$15 events") 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log avg. wage") 
			noobs
	;
	esttab b*
			using "$figures_tables/table2_own_effects.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log employment") 
			noobs
	;
	esttab c*
			using "$figures_tables/table2_own_effects.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Separation rate") 
			noobs
	;
	esttab d*
			using "$figures_tables/table2_own_effects.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Separation rate to non-policy firms") 
			noobs
	;
	esttab e*
			using "$figures_tables/table2_own_effects.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log new hires") 
			noobs
	;
	esttab f*
			using "$figures_tables/table2_own_effects.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ci(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(ln_avg_wage_exact )   
			coeflabel(ln_avg_wage_exact  "Total employment elasticity") 
			stats(
				N Ncz Nexp sdgap MeanSep MeanSepNP MeanNH MonthFE CZFE, 
				fmt(%12.3gc) 
				label("Obs" "CZs" "Events" "St. dev. gap" "Sep rate" "Non-policy firms" "Log new hires" "Month from event FEs" "CZ FEs")
			)
			prefoot(\midrule) 
			postfoot(\bottomrule\bottomrule \end{tabular} \end{threeparttable}) 
			substitute("Month from" "\midrule Month from" "St. dev. gap" "\midrule St. dev. gap" "Sep rate" "\multicolumn{1}{l}{\textit{Pre-period mean:}} \\ Sep rate" "Non-policy firms" "Sep rate to non-policy firms")
	;
	#d cr

*------------------------------------------------------------------------------------------------------------%	
* Table C1: Large retailer VMW effects on own wages, base pay, and gross pay
*------------------------------------------------------------------------------------------------------------%	
* Load own policy firm data
	use "$data/cb/stacked_policy_firm_dataset.dta", clear
	
	gen own_gap=T
	
	* Restrict to experiment window
	keep if inrange(etime,-6, 5)
	drop if trt_exp==4
	
	* Indicator for post policy
	gen postperiod = etime>=0

	* ln_avg_wage_exact ln_avg_monthly_pay ln_avg_monthly_pay_ytd ln_avg_grs_total      
	
	* Regress ------------------------------------------------------------------
	eststo clear
	
	* All
	preserve
	keep if !missing(ln_avg_monthly_pay) & !missing(ln_avg_monthly_pay_ytd) & !missing(ln_avg_grs_total) & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a1: reghdfe ln_avg_wage_exact  D if !missing(ln_avg_monthly_pay) & !missing(ln_avg_monthly_pay_ytd) & !missing(ln_avg_grs_total) & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
		gen keep1 = e(sample) == 1
	eststo b1: reghdfe ln_avg_monthly_pay D if keep1 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	eststo c1: reghdfe ln_avg_monthly_pay_ytd D if keep1 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	eststo d1: reghdfe ln_avg_grs_total D if keep1 == 1 , absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
		distinct cz if keep1 == 1
		estadd local Ncz `r(ndistinct)'
		sum own_gap if keep1 == 1
		estadd local sdgap=round(`r(sd)',.01)
		distinct trt_exp if keep1 ==1
		estadd local Nexp `r(ndistinct)'
		foreach var of varlist ln_avg_wage_exact ln_avg_monthly_pay ln_avg_monthly_pay_ytd ln_avg_grs_total {
			sum `var' if keep1==1 & postperiod==0
			local Mean_`var': di %6.2g `r(mean)'
			estadd local Mean_`var' = `Mean_`var''
		}
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"

	restore
	
	* Major
	preserve
	keep if share_affected > .3 & !missing(ln_avg_monthly_pay) & !missing(ln_avg_monthly_pay_ytd) & !missing(ln_avg_grs_total) & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a2: reghdfe ln_avg_wage_exact  D if share_affected > .3 & !missing(ln_avg_monthly_pay) & !missing(ln_avg_monthly_pay_ytd) & !missing(ln_avg_grs_total) & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
		gen keep2 = e(sample) == 1
	eststo b2: reghdfe ln_avg_monthly_pay D if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	eststo c2: reghdfe ln_avg_monthly_pay_ytd D if keep2 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	eststo d2: reghdfe ln_avg_grs_total D if keep2 == 1 , absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
		distinct cz if keep2 == 1
		estadd local Ncz `r(ndistinct)'
		sum own_gap if keep2 == 1
		estadd local sdgap=round(`r(sd)',.01)
		distinct trt_exp if keep2 ==1
		estadd local Nexp `r(ndistinct)'
		foreach var of varlist ln_avg_wage_exact ln_avg_monthly_pay ln_avg_monthly_pay_ytd ln_avg_grs_total {
			sum `var' if keep2==1 & postperiod==0
			local Mean_`var': di %6.2g `r(mean)'
			estadd local Mean_`var' = `Mean_`var''
		}
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"
	restore	
	
	* $15
	preserve
	keep if mw == 15 & !missing(ln_avg_monthly_pay) & !missing(ln_avg_monthly_pay_ytd) & !missing(ln_avg_grs_total) & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a3: reghdfe ln_avg_wage_exact  D if mw == 15 & !missing(ln_avg_monthly_pay) & !missing(ln_avg_monthly_pay_ytd) & !missing(ln_avg_grs_total) & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
		gen keep3 = e(sample) == 1
	eststo b3: reghdfe ln_avg_monthly_pay D if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	eststo c3: reghdfe ln_avg_monthly_pay_ytd D if keep3 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	eststo d3: reghdfe ln_avg_grs_total D if keep3 == 1 , absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
		distinct cz if keep3 == 1
		estadd local Ncz `r(ndistinct)'
		sum own_gap if keep3 == 1
		estadd local sdgap=round(`r(sd)',.01)
		distinct trt_exp if keep3 ==1
		estadd local Nexp `r(ndistinct)'
		foreach var of varlist ln_avg_wage_exact ln_avg_monthly_pay ln_avg_monthly_pay_ytd ln_avg_grs_total {
			sum `var' if keep3==1 & postperiod==0
			local Mean_`var': di %6.2g `r(mean)'
			estadd local Mean_`var' = `Mean_`var''
		}
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"
	restore
	
	* Build table --------------------------------------------------------------
	
	#d ;
	esttab a* 
			using "$figures_tables/appendix/tablec1_own_effects_gross_pay.tex",  
			replace label fragment
			nolines  
			prehead("\begin{threeparttable} \begin{tabular}{lccccc} \toprule \toprule \\ Indep. Var.: Large Retailer Gap X 1(Post)") 
			posthead("\cmidrule(lr){2-4}" "Dep. Var.:  & & & \\") 
			booktabs								
			nonumbers 
			mtitles("All events" "Major events" "\\$15 events") 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log avg. wage") 
			noobs
	;
	esttab b*
			using "$figures_tables/appendix/tablec1_own_effects_gross_pay.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log avg. monthly base pay") 
			noobs
	;
	esttab c*
			using "$figures_tables/appendix/tablec1_own_effects_gross_pay.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log avg. base pay (YTD)") 
			noobs
	;
	esttab d*
			using "$figures_tables/appendix/tablec1_own_effects_gross_pay.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D )   
			coeflabel(D  "Log avg. gross pay (YTD)") 
			stats(
				N Ncz Nexp sdgap Mean_ln_avg_wage_exact Mean_ln_avg_monthly_pay Mean_ln_avg_monthly_pay_ytd Mean_ln_avg_grs_total MonthFE CZFE, 
				fmt(%12.3gc) 
				label("Obs" "CZs" "Events" "St. dev. gap" "Log wage" "Log base pay" "Log base pay (YTD)" "Log gross pay (YTD)" "Month from event FEs" "CZ FEs")
			)
			prefoot(\midrule) 
			postfoot(\bottomrule\bottomrule \end{tabular} \end{threeparttable}) 
			substitute("Month from" "\midrule Month from" "St. dev. gap" "\midrule St. dev. gap" "Log wage" "\multicolumn{1}{l}{\textit{Pre-period mean:}} \\ Log wage" )
	;
	#d cr
	
*------------------------------------------------------------------------------------------------------------%	
* Table C2: Large retailer VMW effects on own wages and employment, all workers
*------------------------------------------------------------------------------------------------------------%	
* Load own policy firm data
	use "$data/cb/stacked_policy_firm_dataset.dta", clear
	
	gen own_gap=T
	
	* Restrict to experiment window
	keep if inrange(etime,-6, 5)
	drop if trt_exp==4
	
	* Indicator for post policy
	gen postperiod = etime>=0

	* Winsorize new hires variable due to outliers
	*hist ln_tot_new_hires if mw==15
	bysort trt_exp: sum ln_tot_new_hires,d
	replace ln_tot_new_hires = . if ln_tot_new_hires>`r(p90)' | ln_tot_new_hires<`r(p10)'
	
	* Regress ------------------------------------------------------------------
	eststo clear

	* All
	preserve
	keep if !missing(ln_tot_new_hires) & !missing(sep_rate) & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a1: reghdfe ln_avg_wage_exact  D if !missing(ln_tot_new_hires) & !missing(sep_rate) & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local wage_effect=_b[D]
		gen keep1 = e(sample) == 1
	eststo b1: reghdfe ln_tot_emp D if keep1 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local emp_effect=_b[D]
	eststo c1: reghdfe sep_rate D if keep1 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local sep_effect=_b[D]
	eststo d1: reghdfe sep_to_nonpolicy_rate D if keep1 == 1 , absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local quit_effect=_b[D]
	eststo e1: reghdfe ln_tot_new_hires D if keep1 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local nh_effect=_b[D]
	eststo f1: ivreghdfe ln_tot_emp (ln_avg_wage_exact  = D) if keep1 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz) first 
	local emp_elast=_b[ln_avg_wage_exact]
		PrintEst `emp_elast' "emp_elast_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		distinct cz if keep1 == 1
		estadd local Ncz `r(ndistinct)': f1
		sum own_gap if keep1 == 1
		estadd local sdgap=round(`r(sd)',.01): f1
		
		* Save normalized effects (beta divided by average gap)
		* Wage
		local norm_wage_effect=100*(exp(`wage_effect'*`r(mean)')-1)
		PrintEst `norm_wage_effect' "norm_wage_effect_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Emp
		local norm_emp_effect=100*(exp(`emp_effect'*`r(mean)')-1)
		PrintEst `norm_emp_effect' "norm_emp_effect_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Sep
		local norm_sep_effect=abs(100*(`sep_effect'*`r(mean)'))
		PrintEst `norm_sep_effect' "norm_sep_effect_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Sep to non-policy
		local norm_quit_effect=100*(`quit_effect'*`r(mean)')
		PrintEst `norm_quit_effect' "norm_quit_effect_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		* YOY new hires
		local norm_nh_effect=100*(exp(`nh_effect'*`r(mean)')-1)
		PrintEst `norm_nh_effect' "norm_nh_effect_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		
		distinct trt_exp if keep1 ==1
		estadd local Nexp `r(ndistinct)': f1
		sum sep_rate if keep1==1 & postperiod==0
		estadd local MeanSep=round(`r(mean)',.001)
		local norm_rel_sep_effect=100*(`sep_effect'/`r(mean)')
		PrintEst `norm_rel_sep_effect' "norm_rel_sep_effect_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		sum sep_to_nonpolicy_rate if keep1==1 & postperiod==0
		estadd local MeanSepNP=round(`r(mean)',.001)
		local norm_rel_quit_effect=100*(`quit_effect'/`r(mean)')
		PrintEst `norm_rel_quit_effect' "norm_rel_quit_effect_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		
		local quit_elast=`quit_effect'/`r(mean)'
		PrintEst `quit_elast' "quit_elast_all"	"" "%" 4.2f "$figures_tables/appendix/text"
		local LS_elast=abs(2*`quit_elast')
		PrintEst `LS_elast' "LS_elast_all"	"" "%" 4.2f "$figures_tables/appendix/text"
	
		sum ln_tot_new_hires if keep1==1 & postperiod==0
		estadd local MeanNH=round(`r(mean)',.01)
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"

	restore
	
	* Major
	preserve
	keep if !missing(ln_tot_new_hires) & !missing(sep_rate) & share_affected >= .3 & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a2: reghdfe ln_avg_wage_exact  D if !missing(ln_tot_new_hires) & !missing(sep_rate) & share_affected >= .3 & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local wage_effect=_b[D]
		gen keep2 = e(sample) == 1
	eststo b2: reghdfe ln_tot_emp D if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local emp_effect=_b[D]
	eststo c2: reghdfe sep_rate D if keep2 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local sep_effect=_b[D]
	eststo d2: reghdfe sep_to_nonpolicy_rate D if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local quit_effect=_b[D]
	eststo e2: reghdfe ln_tot_new_hires D if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local nh_effect=_b[D]
	eststo f2: ivreghdfe ln_tot_emp (ln_avg_wage_exact  = D) if keep2 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz) first 
	local emp_elast=_b[ln_avg_wage_exact]
		PrintEst `emp_elast' "emp_elast_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		distinct cz if keep2 == 1
		estadd local Ncz `r(ndistinct)': f2
		sum own_gap if keep2 == 1
		estadd local sdgap=round(`r(sd)',.01): f2 
		
		* Save normalized effects (beta divided by average gap)
		* Wage
		local norm_wage_effect=100*(exp(`wage_effect'*`r(mean)')-1)
		PrintEst `norm_wage_effect' "norm_wage_effect_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Emp
		local norm_emp_effect=100*(exp(`emp_effect'*`r(mean)')-1)
		PrintEst `norm_emp_effect' "norm_emp_effect_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Sep
		local norm_sep_effect=abs(100*(`sep_effect'*`r(mean)'))
		PrintEst `norm_sep_effect' "norm_sep_effect_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Sep to non-policy
		local norm_quit_effect=100*(`quit_effect'*`r(mean)')
		PrintEst `norm_quit_effect' "norm_quit_effect_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		* YOY new hires
		local norm_nh_effect=100*(exp(`nh_effect'*`r(mean)')-1)
		PrintEst `norm_nh_effect' "norm_nh_effect_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		
		distinct trt_exp if keep2 ==1
		estadd local Nexp `r(ndistinct)': f2
		sum sep_rate if keep2==1 & postperiod==0
		estadd local MeanSep=round(`r(mean)',.001)
		local norm_rel_sep_effect=100*(`sep_effect'/`r(mean)')
		PrintEst `norm_rel_sep_effect' "norm_rel_sep_effect_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		sum sep_to_nonpolicy_rate if keep2==1 & postperiod==0
		estadd local MeanSepNP=round(`r(mean)',.001)
		local norm_rel_quit_effect=100*(`quit_effect'/`r(mean)')
		PrintEst `norm_rel_quit_effect' "norm_rel_quit_effect_major"	"" "%" 4.2f "$figures_tables/appendix/text"

		local quit_elast=`quit_effect'/`r(mean)'
		PrintEst `quit_elast' "quit_elast_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		local LS_elast=abs(2*`quit_elast')
		PrintEst `LS_elast' "LS_elast_major"	"" "%" 4.2f "$figures_tables/appendix/text"
		
		sum ln_tot_new_hires if keep2==1 & postperiod==0
		estadd local MeanNH=round(`r(mean)',.01)
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"
	
	restore
	
	* $15
	preserve
	keep if !missing(ln_tot_new_hires) & !missing(sep_rate) & mw == 15 & balanced_short == 1
	egen own_gap_std=std(own_gap)
	replace T=own_gap_std	
	
	* Generate treatment variable
	gen D = T*postperiod
	
	eststo a3: reghdfe ln_avg_wage_exact  D if !missing(ln_tot_new_hires) & !missing(sep_rate) & mw == 15 & balanced_short == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local wage_effect=_b[D]
		gen keep3 = e(sample) == 1
	eststo b3: reghdfe ln_tot_emp D if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local emp_effect=_b[D]
	eststo c3: reghdfe sep_rate D if keep3 == 1 & outlier_retain==0, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local sep_effect=_b[D]
	eststo d3: reghdfe sep_to_nonpolicy_rate D if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local quit_effect=_b[D]
	eststo e3: reghdfe ln_tot_new_hires D if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz)
	local nh_effect=_b[D]
	eststo f3: ivreghdfe ln_tot_emp (ln_avg_wage_exact  = D) if keep3 == 1, absorb(i.etime#i.trt_exp i.cz#i.trt_exp i.cz i.etime i.trt_exp) cluster(cz) first 
	local emp_elast=_b[ln_avg_wage_exact]
		PrintEst `emp_elast' "emp_elast_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		distinct cz if keep3 == 1
		estadd local Ncz `r(ndistinct)': f3
		sum own_gap if keep3 == 1
		estadd local sdgap=round(`r(sd)',.01): f3
		
		* Save normalized effects (beta divided by average gap)
		* Wage
		local norm_wage_effect=100*(exp(`wage_effect'*`r(mean)')-1)
		PrintEst `norm_wage_effect' "norm_wage_effect_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Emp
		local norm_emp_effect=100*(exp(`emp_effect'*`r(mean)')-1)
		PrintEst `norm_emp_effect' "norm_emp_effect_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Sep
		local norm_sep_effect=abs(100*(`sep_effect'*`r(mean)'))
		PrintEst `norm_sep_effect' "norm_sep_effect_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		* Sep to non-policy
		local norm_quit_effect=100*(`quit_effect'*`r(mean)')
		PrintEst `norm_quit_effect' "norm_quit_effect_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		* YOY new hires
		local norm_nh_effect=100*(exp(`nh_effect'*`r(mean)')-1)
		PrintEst `norm_nh_effect' "norm_nh_effect_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		
		distinct trt_exp if keep3 ==1
		estadd local Nexp `r(ndistinct)': f3
		sum sep_rate if keep3==1 & postperiod==0
		estadd local MeanSep=round(`r(mean)',.001)
		local norm_rel_sep_effect=100*(`sep_effect'/`r(mean)')
		PrintEst `norm_rel_sep_effect' "norm_rel_sep_effect_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		sum sep_to_nonpolicy_rate if keep3==1 & postperiod==0
		estadd local MeanSepNP=round(`r(mean)',.001)
		local norm_rel_quit_effect=100*(`quit_effect'/`r(mean)')
		PrintEst `norm_rel_quit_effect' "norm_rel_quit_effect_15"	"" "%" 4.2f "$figures_tables/appendix/text"

		local quit_elast=`quit_effect'/`r(mean)'
		PrintEst `quit_elast' "quit_elast_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		local LS_elast=abs(2*`quit_elast')
		PrintEst `LS_elast' "LS_elast_15"	"" "%" 4.2f "$figures_tables/appendix/text"
		
		sum ln_tot_new_hires if keep3==1 & postperiod==0
		estadd local MeanNH=round(`r(mean)',.01)
		estadd local MonthFE = "Y"
		estadd local CZFE = "Y"
	
	restore
	
	* Build table --------------------------------------------------------------
	
	#d ;
	esttab a* 
			using "$figures_tables/appendix/tablec2_own_effects_all_emp_robustness.tex",  
			replace label fragment
			nolines  
			prehead("\begin{threeparttable} \begin{tabular}{lccccc} \toprule \toprule \\ Indep. Var.: Large Retailer Gap X 1(Post)") 
			posthead("\cmidrule(lr){2-4}" "Dep. Var.:  & & & \\") 
			booktabs								
			nonumbers 
			mtitles("All events" "Major events" "\\$15 events") 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log avg. wage") 
			noobs
	;
	esttab b*
			using "$figures_tables/appendix/tablec2_own_effects_all_emp_robustness.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log employment") 
			noobs
	;
	esttab c*
			using "$figures_tables/appendix/tablec2_own_effects_all_emp_robustness.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Separation rate") 
			noobs
	;
	esttab d*
			using "$figures_tables/appendix/tablec2_own_effects_all_emp_robustness.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Separation rate to non-policy firms") 
			noobs
	;
	esttab e*
			using "$figures_tables/appendix/tablec2_own_effects_all_emp_robustness.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(D)   
			coeflabel(D "Log new hires") 
			noobs
	;
	esttab f*
			using "$figures_tables/appendix/tablec2_own_effects_all_emp_robustness.tex",  
			append fragment
			nolines  
			prehead("\\") posthead("") 
			booktabs								
			nonumbers 
			nomtitles 
			collabels(none)  
			cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)) ci(par fmt(%9.3f)) ) 
			starlevels(* 0.1 ** 0.05 *** 0.01) 						
			keep(ln_avg_wage_exact )   
			coeflabel(ln_avg_wage_exact  "Total employment elasticity") 
			stats(
				N Ncz Nexp sdgap MeanSep MeanSepNP MeanNH MonthFE CZFE, 
				fmt(%12.0gc) 
				label("Obs" "CZs" "Events" "St. dev. gap" "Sep rate" "Non-policy firms" "Log new hires" "Month from event FEs" "CZ FEs")
			)
			prefoot(\midrule) 
			postfoot(\bottomrule\bottomrule \end{tabular} \end{threeparttable}) 
			substitute("Month from" "\midrule Month from" "St. dev. gap" "\midrule St. dev. gap" "Sep rate" "\multicolumn{1}{l}{\textit{Pre-period mean:}} \\ Sep rate" "Non-policy firms" "Sep rate to non-policy firms")
	;
	#d cr	
